package at.ac.tuwien.sepm.s2011.e0208329.dao;

public class DAOFactoryImpl implements DAOFactory {
	private DienstleistungDAOImpl serviceDAO;
	private RechnungDAOImpl billDAO;
	private OrderDAOImpl orderDAO;
	public static DAOFactoryImpl refDAOFactory;

	
	/**
	 * Create a new DAOFactory instance and initiate also DAO objects
	 */
	public DAOFactoryImpl() {
		super();
		this.serviceDAO = new DienstleistungDAOImpl();
		this.billDAO = new RechnungDAOImpl();
		this.orderDAO = new OrderDAOImpl();
	}
	
	public static DAOFactoryImpl getDAOFactory() {
		if (refDAOFactory == null) {
			refDAOFactory = new DAOFactoryImpl(); //initialize
		}
		return refDAOFactory;
	}

	@Override
	public DienstleistungDAOImpl getServiceDAO() {
		return serviceDAO;
	}

	@Override
	public RechnungDAOImpl getBillDAO() {
		return billDAO;
	}

	public OrderDAOImpl getOrderDAO() {

		return orderDAO;
	}

}
